import { findUserInfo } from '@/api/common'

export const getUserInfo = () => {
  return new Promise((resolve) => {
    findUserInfo().then((res) => {
      const result = res.result
      // 更新 form 初始化 giveStaffId
      resolve({
        employeeId: result.employeeId,
        employeeName: result.realname,
      })
    })
  })
}

// 处理合同列表数据，增加 status 和 title
export const handleContracList = (list) => {
  list.forEach((contract) => {
    if (contract.contractFileId) {
      contract.status = 'view'
    }
  })
  return list
}
